package com.kiwilss.aopdemo.ui.dsl

/**
 * @author : Administrator
 * e-mail : kiwilss@163.com
 * time   : 2021/02/05
 *  desc   :
 */
data class User2(var name: String = "", var age: Int = 0) {
    override fun toString(): String {
        return "My name is $name ,i am $age years old"
    }
}


fun create(block: User2.() -> Unit): User2 {
    val user2 = User2()
//    block(user2)
    user2.block()
    return user2
}

infix fun Int.plus(x: Int) = this.plus(x)


fun main() {
    val user2 = User2("hl", 22)
    println(user2)
    println("----------------------------")
    val user22 = create {
        name = "hhhh"
        age = 99
    }
    println(user22)




}